<template>
  <div class="covid-card">
    <div class="city">
      <span class="name">{{ list.cityName }}</span>
      <span class="time">{{ time }}</span>
    </div>
    <div class="detail">
      <div class="item">
        <span class="detail-item-num">{{ list.confirmedCount }}</span>
        <span class="detail-item-font">确诊</span>
        <div class="detail-item-before">
          <span>较昨日</span>
          <span class="detail-item-before-confiremed">+0</span>
        </div>
      </div>
      <div class="item">
        <span class="detail-item-num">{{ list.curedCount }}</span>
        <span class="detail-item-font">治愈</span>
        <div class="detail-item-before">
          <span>较昨日</span>
          <span class="detail-item-before-cured">+0</span>
        </div>
      </div>
      <div class="item">
        <span class="detail-item-num">{{ list.deadCount }}</span>
        <span class="detail-item-font">死亡</span>
        <div class="detail-item-before">
          <span>较昨日</span>
          <span class="detail-item-before-dead">+0</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import axios from "axios";
export default {
  name: "CovidCard",
  props: {
    list: {
      type: Array,
    },
    time: String,
  },
  created() {
    axios({
      methods: "get",
      url: "http://111.231.75.86:8000/api/cities/CHN/珠海",
    }).then((res) => {
      console.log(res);
      console.log(res.data);
      this.list = res.data;
    });
    this.getDate();
  },
  methods: {
    getDate() {
      var date = new Date();
      console.log(date);
      console.log(date.getFullYear());
      console.log(date.getDay());
      this.time =
        date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
    },
  },
};
</script>
<style lang="scss" scoped>
.covid-card{
  margin: 10px 0px 10px 0px;
  padding: 10px 0px 10px 10px;
  height: 140px;
  background-color: white;
  border-radius: 5px;
}

.city{
  display: flex;
  justify-content: space-between;
  margin: 10px 10px 10px 10px;
  .name{
    font-weight: 1000;
  }
  .time{
    color: #B9B9B9;
  }  
}

    

.detail{
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 20px 10px 20px 10px;
  .item{
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    width: 100px;
    height: 80px;
  }

}

  
.detail-item-num{
  width: 100px;
  text-align: center;
  font-weight: 1000;;
}


.detail-item-font{
  width: 100px;
  text-align: center;
}


.detail-item-before{
  font-size: 12px;
  color: #B9B9B9;
}

.detail-item-before-confiremed{
  color: #FA5252
}

.detail-item-before-cured{
color: #3BCC7F
}
  
.detail-item-before-dead{
  color: #979797
}

</style>
